package com.data.hijack.readable;

import java.nio.channels.SocketChannel;

import org.jsoup.Connection;

/**
 * Thread Safe
 * 
 * @author husq
 */
@FunctionalInterface
public interface ReadablePlugin {
    /**
     * Read request data
     *
     * @param channel
     * @return
     */
    default String read(SocketChannel channel) {
        return null;
    }

    /**
     * Get custom business codes
     * 
     * @param channel
     * @return
     */
    String getBizName(SocketChannel channel);

    /**
     * Based on the HTTP protocol request, a Connection.Response needs to be returned to the calling end
     * 
     * @return
     */
    default Connection.Response getResponse() {
        return null;
    }
}
